﻿/**  PACS v1.0
* YW_PatientVisitInfo.cs
*
* 类 名： YW_PatientVisitInfo
*
* Ver    变更日期             负责人  变更内容
* ───────────────────────────────────
* V0.01  2018/6/5 15:24:38   douwd    初版
*
*/
using System;
using System.Data;
using System.Text;
using System.Data.SqlClient;
using Maticsoft.DBUtility;//Please add references
namespace Pacs.DAL
{
	/// <summary>
	/// 数据访问类:YW_PatientVisitInfo
	/// </summary>
	public partial class YW_PatientVisitInfo
	{
		public YW_PatientVisitInfo()
		{}
		#region  Method


		/// <summary>
		/// 是否存在该记录
		/// </summary>
		public bool Exists(string ID)
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("select count(1) from YW_PatientVisitInfo");
			strSql.Append(" where ID='"+ID+"' ");
			return DbHelperSQL.Exists(strSql.ToString());
		}

		/// <summary>
		/// 增加一条数据
		/// </summary>
		public bool Add(Pacs.Model.YW_PatientVisitInfo model)
		{
			StringBuilder strSql=new StringBuilder();
			StringBuilder strSql1=new StringBuilder();
			StringBuilder strSql2=new StringBuilder();
			if (model.ID != null)
			{
				strSql1.Append("ID,");
				strSql2.Append("'"+model.ID+"',");
			}
			if (model.JB_PatientBasicInfoID != null)
			{
				strSql1.Append("JB_PatientBasicInfoID,");
				strSql2.Append("'"+model.JB_PatientBasicInfoID+"',");
			}
			if (model.JiuZhenNO != null)
			{
				strSql1.Append("JiuZhenNO,");
				strSql2.Append("'"+model.JiuZhenNO+"',");
			}
			if (model.ShenFenZhengNo != null)
			{
				strSql1.Append("ShenFenZhengNo,");
				strSql2.Append("'"+model.ShenFenZhengNo+"',");
			}
			if (model.XingMing != null)
			{
				strSql1.Append("XingMing,");
				strSql2.Append("'"+model.XingMing+"',");
			}
			if (model.XingBie != null)
			{
				strSql1.Append("XingBie,");
				strSql2.Append("'"+model.XingBie+"',");
			}
			if (model.MinZu != null)
			{
				strSql1.Append("MinZu,");
				strSql2.Append("'"+model.MinZu+"',");
			}
			if (model.ChuShengRiQi != null)
			{
				strSql1.Append("ChuShengRiQi,");
				strSql2.Append("'"+model.ChuShengRiQi+"',");
			}
			if (model.BingRenLaiYuanID != null)
			{
				strSql1.Append("BingRenLaiYuanID,");
				strSql2.Append("'"+model.BingRenLaiYuanID+"',");
			}
			if (model.BingRenLeiXingID != null)
			{
				strSql1.Append("BingRenLeiXingID,");
				strSql2.Append("'"+model.BingRenLeiXingID+"',");
			}
			if (model.BingRenLeiXing != null)
			{
				strSql1.Append("BingRenLeiXing,");
				strSql2.Append("'"+model.BingRenLeiXing+"',");
			}
			if (model.DengJiShiJian != null)
			{
				strSql1.Append("DengJiShiJian,");
				strSql2.Append("'"+model.DengJiShiJian+"',");
			}
			if (model.DengJiRenID != null)
			{
				strSql1.Append("DengJiRenID,");
				strSql2.Append("'"+model.DengJiRenID+"',");
			}
			if (model.DengJiRenNO != null)
			{
				strSql1.Append("DengJiRenNO,");
				strSql2.Append("'"+model.DengJiRenNO+"',");
			}
			if (model.DengJiRenXingMing != null)
			{
				strSql1.Append("DengJiRenXingMing,");
				strSql2.Append("'"+model.DengJiRenXingMing+"',");
			}
			if (model.KeShiNO != null)
			{
				strSql1.Append("KeShiNO,");
				strSql2.Append("'"+model.KeShiNO+"',");
			}
			if (model.KeShiMingCheng != null)
			{
				strSql1.Append("KeShiMingCheng,");
				strSql2.Append("'"+model.KeShiMingCheng+"',");
			}
			if (model.BingQuNO != null)
			{
				strSql1.Append("BingQuNO,");
				strSql2.Append("'"+model.BingQuNO+"',");
			}
			if (model.BingQuMingCheng != null)
			{
				strSql1.Append("BingQuMingCheng,");
				strSql2.Append("'"+model.BingQuMingCheng+"',");
			}
			if (model.MenZhenNO != null)
			{
				strSql1.Append("MenZhenNO,");
				strSql2.Append("'"+model.MenZhenNO+"',");
			}
			if (model.ZhuYuanNO != null)
			{
				strSql1.Append("ZhuYuanNO,");
				strSql2.Append("'"+model.ZhuYuanNO+"',");
			}
			if (model.MenZhenZhuYuanBiaoShi != null)
			{
				strSql1.Append("MenZhenZhuYuanBiaoShi,");
				strSql2.Append("'"+model.MenZhenZhuYuanBiaoShi+"',");
			}
			if (model.LinChuangZhenDuan != null)
			{
				strSql1.Append("LinChuangZhenDuan,");
				strSql2.Append("'"+model.LinChuangZhenDuan+"',");
			}
			if (model.LinChuangZhenDuanBianMa != null)
			{
				strSql1.Append("LinChuangZhenDuanBianMa,");
				strSql2.Append("'"+model.LinChuangZhenDuanBianMa+"',");
			}
			if (model.YingXiangZhenDuanBianMa != null)
			{
				strSql1.Append("YingXiangZhenDuanBianMa,");
				strSql2.Append("'"+model.YingXiangZhenDuanBianMa+"',");
			}
			if (model.YingXiangZhenDuan != null)
			{
				strSql1.Append("YingXiangZhenDuan,");
				strSql2.Append("'"+model.YingXiangZhenDuan+"',");
			}
			if (model.XiuGaiShiJian != null)
			{
				strSql1.Append("XiuGaiShiJian,");
				strSql2.Append("'"+model.XiuGaiShiJian+"',");
			}
			if (model.XiuGaiRenID != null)
			{
				strSql1.Append("XiuGaiRenID,");
				strSql2.Append("'"+model.XiuGaiRenID+"',");
			}
			if (model.XiuGaiRenNO != null)
			{
				strSql1.Append("XiuGaiRenNO,");
				strSql2.Append("'"+model.XiuGaiRenNO+"',");
			}
			if (model.XiuGaiRenXingMing != null)
			{
				strSql1.Append("XiuGaiRenXingMing,");
				strSql2.Append("'"+model.XiuGaiRenXingMing+"',");
			}
			if (model.JiuZhenZhuangTai != null)
			{
				strSql1.Append("JiuZhenZhuangTai,");
				strSql2.Append("'"+model.JiuZhenZhuangTai+"',");
			}
			if (model.XiTongGuanLianHao != null)
			{
				strSql1.Append("XiTongGuanLianHao,");
				strSql2.Append("'"+model.XiTongGuanLianHao+"',");
			}
			if (model.JiuZhenKeShiID != null)
			{
				strSql1.Append("JiuZhenKeShiID,");
				strSql2.Append("'"+model.JiuZhenKeShiID+"',");
			}
			if (model.JianChaKeShiNO != null)
			{
				strSql1.Append("JianChaKeShiNO,");
				strSql2.Append("'"+model.JianChaKeShiNO+"',");
			}
			if (model.JianChaKeShiMingCheng != null)
			{
				strSql1.Append("JianChaKeShiMingCheng,");
				strSql2.Append("'"+model.JianChaKeShiMingCheng+"',");
			}
			if (model.YingWenMing != null)
			{
				strSql1.Append("YingWenMing,");
				strSql2.Append("'"+model.YingWenMing+"',");
			}
			if (model.JiuZhenShiJian != null)
			{
				strSql1.Append("JiuZhenShiJian,");
				strSql2.Append("'"+model.JiuZhenShiJian+"',");
			}
			if (model.WanChengShiJian != null)
			{
				strSql1.Append("WanChengShiJian,");
				strSql2.Append("'"+model.WanChengShiJian+"',");
			}
			if (model.BingChuangHao != null)
			{
				strSql1.Append("BingChuangHao,");
				strSql2.Append("'"+model.BingChuangHao+"',");
			}
			if (model.JianChaJiGouBianMa != null)
			{
				strSql1.Append("JianChaJiGouBianMa,");
				strSql2.Append("'"+model.JianChaJiGouBianMa+"',");
			}
			if (model.JianChaJiGouID != null)
			{
				strSql1.Append("JianChaJiGouID,");
				strSql2.Append("'"+model.JianChaJiGouID+"',");
			}
			if (model.JianChaJiGouMing != null)
			{
				strSql1.Append("JianChaJiGouMing,");
				strSql2.Append("'"+model.JianChaJiGouMing+"',");
			}
			if (model.XieTongBiaoShi != null)
			{
				strSql1.Append("XieTongBiaoShi,");
				strSql2.Append("'"+model.XieTongBiaoShi+"',");
			}
			if (model.QuYvShangChuanBiaoShi != null)
			{
				strSql1.Append("QuYvShangChuanBiaoShi,");
				strSql2.Append("'"+model.QuYvShangChuanBiaoShi+"',");
			}
			if (model.QuYvQingQiuZhuangTai != null)
			{
				strSql1.Append("QuYvQingQiuZhuangTai,");
				strSql2.Append("'"+model.QuYvQingQiuZhuangTai+"',");
			}
			if (model.SheBeiJianChaLiuShui != null)
			{
				strSql1.Append("SheBeiJianChaLiuShui,");
				strSql2.Append("'"+model.SheBeiJianChaLiuShui+"',");
			}
			if (model.XianZhuZhi != null)
			{
				strSql1.Append("XianZhuZhi,");
				strSql2.Append("'"+model.XianZhuZhi+"',");
			}
			if (model.GongZuoDanWei != null)
			{
				strSql1.Append("GongZuoDanWei,");
				strSql2.Append("'"+model.GongZuoDanWei+"',");
			}
			if (model.JianChaZhuTuo != null)
			{
				strSql1.Append("JianChaZhuTuo,");
				strSql2.Append("'"+model.JianChaZhuTuo+"',");
			}
			if (model.HuJi != null)
			{
				strSql1.Append("HuJi,");
				strSql2.Append("'"+model.HuJi+"',");
			}
			if (model.DianHua != null)
			{
				strSql1.Append("DianHua,");
				strSql2.Append("'"+model.DianHua+"',");
			}
			if (model.LianXiRen != null)
			{
				strSql1.Append("LianXiRen,");
				strSql2.Append("'"+model.LianXiRen+"',");
			}
			if (model.LianXiRenDianHua != null)
			{
				strSql1.Append("LianXiRenDianHua,");
				strSql2.Append("'"+model.LianXiRenDianHua+"',");
			}
			if (model.HunShi != null)
			{
				strSql1.Append("HunShi,");
				strSql2.Append("'"+model.HunShi+"',");
			}
			if (model.XueXing != null)
			{
				strSql1.Append("XueXing,");
				strSql2.Append("'"+model.XueXing+"',");
			}
			if (model.RHXueXing != null)
			{
				strSql1.Append("RHXueXing,");
				strSql2.Append("'"+model.RHXueXing+"',");
			}
			if (model.HuJiDiShengID != null)
			{
				strSql1.Append("HuJiDiShengID,");
				strSql2.Append("'"+model.HuJiDiShengID+"',");
			}
			if (model.HuJiDiShiID != null)
			{
				strSql1.Append("HuJiDiShiID,");
				strSql2.Append("'"+model.HuJiDiShiID+"',");
			}
			if (model.HuJiDiXingZhengQuID != null)
			{
				strSql1.Append("HuJiDiXingZhengQuID,");
				strSql2.Append("'"+model.HuJiDiXingZhengQuID+"',");
			}
			if (model.HuJiDiSheng != null)
			{
				strSql1.Append("HuJiDiSheng,");
				strSql2.Append("'"+model.HuJiDiSheng+"',");
			}
			if (model.HuJiDiShi != null)
			{
				strSql1.Append("HuJiDiShi,");
				strSql2.Append("'"+model.HuJiDiShi+"',");
			}
			if (model.HuJiDiXingZhengQu != null)
			{
				strSql1.Append("HuJiDiXingZhengQu,");
				strSql2.Append("'"+model.HuJiDiXingZhengQu+"',");
			}
			if (model.HuJiDiZhi != null)
			{
				strSql1.Append("HuJiDiZhi,");
				strSql2.Append("'"+model.HuJiDiZhi+"',");
			}
			if (model.QuYvBianMa != null)
			{
				strSql1.Append("QuYvBianMa,");
				strSql2.Append("'"+model.QuYvBianMa+"',");
			}
			if (model.QuYvMingCheng != null)
			{
				strSql1.Append("QuYvMingCheng,");
				strSql2.Append("'"+model.QuYvMingCheng+"',");
			}
			if (model.ShenQingZhaiYao != null)
			{
				strSql1.Append("ShenQingZhaiYao,");
				strSql2.Append("'"+model.ShenQingZhaiYao+"',");
			}
			strSql.Append("insert into YW_PatientVisitInfo(");
			strSql.Append(strSql1.ToString().Remove(strSql1.Length - 1));
			strSql.Append(")");
			strSql.Append(" values (");
			strSql.Append(strSql2.ToString().Remove(strSql2.Length - 1));
			strSql.Append(")");
			int rows=DbHelperSQL.ExecuteSql(strSql.ToString());
			if (rows > 0)
			{
				return true;
			}
			else
			{
				return false;
			}
		}

		/// <summary>
		/// 更新一条数据
		/// </summary>
		public bool Update(Pacs.Model.YW_PatientVisitInfo model)
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("update YW_PatientVisitInfo set ");
			if (model.JB_PatientBasicInfoID != null)
			{
				strSql.Append("JB_PatientBasicInfoID='"+model.JB_PatientBasicInfoID+"',");
			}
			else
			{
				strSql.Append("JB_PatientBasicInfoID= null ,");
			}
			if (model.JiuZhenNO != null)
			{
				strSql.Append("JiuZhenNO='"+model.JiuZhenNO+"',");
			}
			else
			{
				strSql.Append("JiuZhenNO= null ,");
			}
			if (model.ShenFenZhengNo != null)
			{
				strSql.Append("ShenFenZhengNo='"+model.ShenFenZhengNo+"',");
			}
			else
			{
				strSql.Append("ShenFenZhengNo= null ,");
			}
			if (model.XingMing != null)
			{
				strSql.Append("XingMing='"+model.XingMing+"',");
			}
			else
			{
				strSql.Append("XingMing= null ,");
			}
			if (model.XingBie != null)
			{
				strSql.Append("XingBie='"+model.XingBie+"',");
			}
			else
			{
				strSql.Append("XingBie= null ,");
			}
			if (model.MinZu != null)
			{
				strSql.Append("MinZu='"+model.MinZu+"',");
			}
			else
			{
				strSql.Append("MinZu= null ,");
			}
			if (model.ChuShengRiQi != null)
			{
				strSql.Append("ChuShengRiQi='"+model.ChuShengRiQi+"',");
			}
			else
			{
				strSql.Append("ChuShengRiQi= null ,");
			}
			if (model.BingRenLaiYuanID != null)
			{
				strSql.Append("BingRenLaiYuanID='"+model.BingRenLaiYuanID+"',");
			}
			else
			{
				strSql.Append("BingRenLaiYuanID= null ,");
			}
			if (model.BingRenLeiXingID != null)
			{
				strSql.Append("BingRenLeiXingID='"+model.BingRenLeiXingID+"',");
			}
			else
			{
				strSql.Append("BingRenLeiXingID= null ,");
			}
			if (model.BingRenLeiXing != null)
			{
				strSql.Append("BingRenLeiXing='"+model.BingRenLeiXing+"',");
			}
			else
			{
				strSql.Append("BingRenLeiXing= null ,");
			}
			if (model.DengJiShiJian != null)
			{
				strSql.Append("DengJiShiJian='"+model.DengJiShiJian+"',");
			}
			else
			{
				strSql.Append("DengJiShiJian= null ,");
			}
			if (model.DengJiRenID != null)
			{
				strSql.Append("DengJiRenID='"+model.DengJiRenID+"',");
			}
			else
			{
				strSql.Append("DengJiRenID= null ,");
			}
			if (model.DengJiRenNO != null)
			{
				strSql.Append("DengJiRenNO='"+model.DengJiRenNO+"',");
			}
			else
			{
				strSql.Append("DengJiRenNO= null ,");
			}
			if (model.DengJiRenXingMing != null)
			{
				strSql.Append("DengJiRenXingMing='"+model.DengJiRenXingMing+"',");
			}
			else
			{
				strSql.Append("DengJiRenXingMing= null ,");
			}
			if (model.KeShiNO != null)
			{
				strSql.Append("KeShiNO='"+model.KeShiNO+"',");
			}
			else
			{
				strSql.Append("KeShiNO= null ,");
			}
			if (model.KeShiMingCheng != null)
			{
				strSql.Append("KeShiMingCheng='"+model.KeShiMingCheng+"',");
			}
			else
			{
				strSql.Append("KeShiMingCheng= null ,");
			}
			if (model.BingQuNO != null)
			{
				strSql.Append("BingQuNO='"+model.BingQuNO+"',");
			}
			else
			{
				strSql.Append("BingQuNO= null ,");
			}
			if (model.BingQuMingCheng != null)
			{
				strSql.Append("BingQuMingCheng='"+model.BingQuMingCheng+"',");
			}
			else
			{
				strSql.Append("BingQuMingCheng= null ,");
			}
			if (model.MenZhenNO != null)
			{
				strSql.Append("MenZhenNO='"+model.MenZhenNO+"',");
			}
			else
			{
				strSql.Append("MenZhenNO= null ,");
			}
			if (model.ZhuYuanNO != null)
			{
				strSql.Append("ZhuYuanNO='"+model.ZhuYuanNO+"',");
			}
			else
			{
				strSql.Append("ZhuYuanNO= null ,");
			}
			if (model.MenZhenZhuYuanBiaoShi != null)
			{
				strSql.Append("MenZhenZhuYuanBiaoShi='"+model.MenZhenZhuYuanBiaoShi+"',");
			}
			else
			{
				strSql.Append("MenZhenZhuYuanBiaoShi= null ,");
			}
			if (model.LinChuangZhenDuan != null)
			{
				strSql.Append("LinChuangZhenDuan='"+model.LinChuangZhenDuan+"',");
			}
			else
			{
				strSql.Append("LinChuangZhenDuan= null ,");
			}
			if (model.LinChuangZhenDuanBianMa != null)
			{
				strSql.Append("LinChuangZhenDuanBianMa='"+model.LinChuangZhenDuanBianMa+"',");
			}
			else
			{
				strSql.Append("LinChuangZhenDuanBianMa= null ,");
			}
			if (model.YingXiangZhenDuanBianMa != null)
			{
				strSql.Append("YingXiangZhenDuanBianMa='"+model.YingXiangZhenDuanBianMa+"',");
			}
			else
			{
				strSql.Append("YingXiangZhenDuanBianMa= null ,");
			}
			if (model.YingXiangZhenDuan != null)
			{
				strSql.Append("YingXiangZhenDuan='"+model.YingXiangZhenDuan+"',");
			}
			else
			{
				strSql.Append("YingXiangZhenDuan= null ,");
			}
			if (model.XiuGaiShiJian != null)
			{
				strSql.Append("XiuGaiShiJian='"+model.XiuGaiShiJian+"',");
			}
			else
			{
				strSql.Append("XiuGaiShiJian= null ,");
			}
			if (model.XiuGaiRenID != null)
			{
				strSql.Append("XiuGaiRenID='"+model.XiuGaiRenID+"',");
			}
			else
			{
				strSql.Append("XiuGaiRenID= null ,");
			}
			if (model.XiuGaiRenNO != null)
			{
				strSql.Append("XiuGaiRenNO='"+model.XiuGaiRenNO+"',");
			}
			else
			{
				strSql.Append("XiuGaiRenNO= null ,");
			}
			if (model.XiuGaiRenXingMing != null)
			{
				strSql.Append("XiuGaiRenXingMing='"+model.XiuGaiRenXingMing+"',");
			}
			else
			{
				strSql.Append("XiuGaiRenXingMing= null ,");
			}
			if (model.JiuZhenZhuangTai != null)
			{
				strSql.Append("JiuZhenZhuangTai='"+model.JiuZhenZhuangTai+"',");
			}
			else
			{
				strSql.Append("JiuZhenZhuangTai= null ,");
			}
			if (model.XiTongGuanLianHao != null)
			{
				strSql.Append("XiTongGuanLianHao='"+model.XiTongGuanLianHao+"',");
			}
			else
			{
				strSql.Append("XiTongGuanLianHao= null ,");
			}
			if (model.JiuZhenKeShiID != null)
			{
				strSql.Append("JiuZhenKeShiID='"+model.JiuZhenKeShiID+"',");
			}
			else
			{
				strSql.Append("JiuZhenKeShiID= null ,");
			}
			if (model.JianChaKeShiNO != null)
			{
				strSql.Append("JianChaKeShiNO='"+model.JianChaKeShiNO+"',");
			}
			else
			{
				strSql.Append("JianChaKeShiNO= null ,");
			}
			if (model.JianChaKeShiMingCheng != null)
			{
				strSql.Append("JianChaKeShiMingCheng='"+model.JianChaKeShiMingCheng+"',");
			}
			else
			{
				strSql.Append("JianChaKeShiMingCheng= null ,");
			}
			if (model.YingWenMing != null)
			{
				strSql.Append("YingWenMing='"+model.YingWenMing+"',");
			}
			else
			{
				strSql.Append("YingWenMing= null ,");
			}
			if (model.JiuZhenShiJian != null)
			{
				strSql.Append("JiuZhenShiJian='"+model.JiuZhenShiJian+"',");
			}
			else
			{
				strSql.Append("JiuZhenShiJian= null ,");
			}
			if (model.WanChengShiJian != null)
			{
				strSql.Append("WanChengShiJian='"+model.WanChengShiJian+"',");
			}
			else
			{
				strSql.Append("WanChengShiJian= null ,");
			}
			if (model.BingChuangHao != null)
			{
				strSql.Append("BingChuangHao='"+model.BingChuangHao+"',");
			}
			else
			{
				strSql.Append("BingChuangHao= null ,");
			}
			if (model.JianChaJiGouBianMa != null)
			{
				strSql.Append("JianChaJiGouBianMa='"+model.JianChaJiGouBianMa+"',");
			}
			else
			{
				strSql.Append("JianChaJiGouBianMa= null ,");
			}
			if (model.JianChaJiGouID != null)
			{
				strSql.Append("JianChaJiGouID='"+model.JianChaJiGouID+"',");
			}
			else
			{
				strSql.Append("JianChaJiGouID= null ,");
			}
			if (model.JianChaJiGouMing != null)
			{
				strSql.Append("JianChaJiGouMing='"+model.JianChaJiGouMing+"',");
			}
			else
			{
				strSql.Append("JianChaJiGouMing= null ,");
			}
			if (model.XieTongBiaoShi != null)
			{
				strSql.Append("XieTongBiaoShi='"+model.XieTongBiaoShi+"',");
			}
			else
			{
				strSql.Append("XieTongBiaoShi= null ,");
			}
			if (model.QuYvShangChuanBiaoShi != null)
			{
				strSql.Append("QuYvShangChuanBiaoShi='"+model.QuYvShangChuanBiaoShi+"',");
			}
			else
			{
				strSql.Append("QuYvShangChuanBiaoShi= null ,");
			}
			if (model.QuYvQingQiuZhuangTai != null)
			{
				strSql.Append("QuYvQingQiuZhuangTai='"+model.QuYvQingQiuZhuangTai+"',");
			}
			else
			{
				strSql.Append("QuYvQingQiuZhuangTai= null ,");
			}
			if (model.SheBeiJianChaLiuShui != null)
			{
				strSql.Append("SheBeiJianChaLiuShui='"+model.SheBeiJianChaLiuShui+"',");
			}
			else
			{
				strSql.Append("SheBeiJianChaLiuShui= null ,");
			}
			if (model.XianZhuZhi != null)
			{
				strSql.Append("XianZhuZhi='"+model.XianZhuZhi+"',");
			}
			else
			{
				strSql.Append("XianZhuZhi= null ,");
			}
			if (model.GongZuoDanWei != null)
			{
				strSql.Append("GongZuoDanWei='"+model.GongZuoDanWei+"',");
			}
			else
			{
				strSql.Append("GongZuoDanWei= null ,");
			}
			if (model.JianChaZhuTuo != null)
			{
				strSql.Append("JianChaZhuTuo='"+model.JianChaZhuTuo+"',");
			}
			else
			{
				strSql.Append("JianChaZhuTuo= null ,");
			}
			if (model.HuJi != null)
			{
				strSql.Append("HuJi='"+model.HuJi+"',");
			}
			else
			{
				strSql.Append("HuJi= null ,");
			}
			if (model.DianHua != null)
			{
				strSql.Append("DianHua='"+model.DianHua+"',");
			}
			else
			{
				strSql.Append("DianHua= null ,");
			}
			if (model.LianXiRen != null)
			{
				strSql.Append("LianXiRen='"+model.LianXiRen+"',");
			}
			else
			{
				strSql.Append("LianXiRen= null ,");
			}
			if (model.LianXiRenDianHua != null)
			{
				strSql.Append("LianXiRenDianHua='"+model.LianXiRenDianHua+"',");
			}
			else
			{
				strSql.Append("LianXiRenDianHua= null ,");
			}
			if (model.HunShi != null)
			{
				strSql.Append("HunShi='"+model.HunShi+"',");
			}
			else
			{
				strSql.Append("HunShi= null ,");
			}
			if (model.XueXing != null)
			{
				strSql.Append("XueXing='"+model.XueXing+"',");
			}
			else
			{
				strSql.Append("XueXing= null ,");
			}
			if (model.RHXueXing != null)
			{
				strSql.Append("RHXueXing='"+model.RHXueXing+"',");
			}
			else
			{
				strSql.Append("RHXueXing= null ,");
			}
			if (model.HuJiDiShengID != null)
			{
				strSql.Append("HuJiDiShengID='"+model.HuJiDiShengID+"',");
			}
			else
			{
				strSql.Append("HuJiDiShengID= null ,");
			}
			if (model.HuJiDiShiID != null)
			{
				strSql.Append("HuJiDiShiID='"+model.HuJiDiShiID+"',");
			}
			else
			{
				strSql.Append("HuJiDiShiID= null ,");
			}
			if (model.HuJiDiXingZhengQuID != null)
			{
				strSql.Append("HuJiDiXingZhengQuID='"+model.HuJiDiXingZhengQuID+"',");
			}
			else
			{
				strSql.Append("HuJiDiXingZhengQuID= null ,");
			}
			if (model.HuJiDiSheng != null)
			{
				strSql.Append("HuJiDiSheng='"+model.HuJiDiSheng+"',");
			}
			else
			{
				strSql.Append("HuJiDiSheng= null ,");
			}
			if (model.HuJiDiShi != null)
			{
				strSql.Append("HuJiDiShi='"+model.HuJiDiShi+"',");
			}
			else
			{
				strSql.Append("HuJiDiShi= null ,");
			}
			if (model.HuJiDiXingZhengQu != null)
			{
				strSql.Append("HuJiDiXingZhengQu='"+model.HuJiDiXingZhengQu+"',");
			}
			else
			{
				strSql.Append("HuJiDiXingZhengQu= null ,");
			}
			if (model.HuJiDiZhi != null)
			{
				strSql.Append("HuJiDiZhi='"+model.HuJiDiZhi+"',");
			}
			else
			{
				strSql.Append("HuJiDiZhi= null ,");
			}
			if (model.QuYvBianMa != null)
			{
				strSql.Append("QuYvBianMa='"+model.QuYvBianMa+"',");
			}
			else
			{
				strSql.Append("QuYvBianMa= null ,");
			}
			if (model.QuYvMingCheng != null)
			{
				strSql.Append("QuYvMingCheng='"+model.QuYvMingCheng+"',");
			}
			else
			{
				strSql.Append("QuYvMingCheng= null ,");
			}
			if (model.ShenQingZhaiYao != null)
			{
				strSql.Append("ShenQingZhaiYao='"+model.ShenQingZhaiYao+"',");
			}
			else
			{
				strSql.Append("ShenQingZhaiYao= null ,");
			}
			int n = strSql.ToString().LastIndexOf(",");
			strSql.Remove(n, 1);
			strSql.Append(" where ID='"+ model.ID+"' ");
			int rowsAffected=DbHelperSQL.ExecuteSql(strSql.ToString());
			if (rowsAffected > 0)
			{
				return true;
			}
			else
			{
				return false;
			}
		}

		/// <summary>
		/// 删除一条数据
		/// </summary>
		public bool Delete(string ID)
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("delete from YW_PatientVisitInfo ");
			strSql.Append(" where ID='"+ID+"' " );
			int rowsAffected=DbHelperSQL.ExecuteSql(strSql.ToString());
			if (rowsAffected > 0)
			{
				return true;
			}
			else
			{
				return false;
			}
		}		/// <summary>
		/// 批量删除数据
		/// </summary>
		public bool DeleteList(string IDlist )
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("delete from YW_PatientVisitInfo ");
			strSql.Append(" where ID in ("+IDlist + ")  ");
			int rows=DbHelperSQL.ExecuteSql(strSql.ToString());
			if (rows > 0)
			{
				return true;
			}
			else
			{
				return false;
			}
		}


		/// <summary>
		/// 得到一个对象实体
		/// </summary>
		public Pacs.Model.YW_PatientVisitInfo GetModel(string ID)
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("select  top 1  ");
			strSql.Append(" ID,JB_PatientBasicInfoID,JiuZhenNO,ShenFenZhengNo,XingMing,XingBie,MinZu,ChuShengRiQi,BingRenLaiYuanID,BingRenLeiXingID,BingRenLeiXing,DengJiShiJian,DengJiRenID,DengJiRenNO,DengJiRenXingMing,KeShiNO,KeShiMingCheng,BingQuNO,BingQuMingCheng,MenZhenNO,ZhuYuanNO,MenZhenZhuYuanBiaoShi,LinChuangZhenDuan,LinChuangZhenDuanBianMa,YingXiangZhenDuanBianMa,YingXiangZhenDuan,XiuGaiShiJian,XiuGaiRenID,XiuGaiRenNO,XiuGaiRenXingMing,JiuZhenZhuangTai,XiTongGuanLianHao,JiuZhenKeShiID,JianChaKeShiNO,JianChaKeShiMingCheng,YingWenMing,JiuZhenShiJian,WanChengShiJian,BingChuangHao,JianChaJiGouBianMa,JianChaJiGouID,JianChaJiGouMing,XieTongBiaoShi,QuYvShangChuanBiaoShi,QuYvQingQiuZhuangTai,SheBeiJianChaLiuShui,XianZhuZhi,GongZuoDanWei,JianChaZhuTuo,HuJi,DianHua,LianXiRen,LianXiRenDianHua,HunShi,XueXing,RHXueXing,HuJiDiShengID,HuJiDiShiID,HuJiDiXingZhengQuID,HuJiDiSheng,HuJiDiShi,HuJiDiXingZhengQu,HuJiDiZhi,QuYvBianMa,QuYvMingCheng,ShenQingZhaiYao ");
			strSql.Append(" from YW_PatientVisitInfo ");
			strSql.Append(" where ID='"+ID+"' " );
			Pacs.Model.YW_PatientVisitInfo model=new Pacs.Model.YW_PatientVisitInfo();
			DataSet ds=DbHelperSQL.Query(strSql.ToString());
			if(ds.Tables[0].Rows.Count>0)
			{
				return DataRowToModel(ds.Tables[0].Rows[0]);
			}
			else
			{
				return null;
			}
		}

		/// <summary>
		/// 得到一个对象实体
		/// </summary>
		public Pacs.Model.YW_PatientVisitInfo DataRowToModel(DataRow row)
		{
			Pacs.Model.YW_PatientVisitInfo model=new Pacs.Model.YW_PatientVisitInfo();
			if (row != null)
			{
				if(row["ID"]!=null)
				{
					model.ID=row["ID"].ToString();
				}
				if(row["JB_PatientBasicInfoID"]!=null)
				{
					model.JB_PatientBasicInfoID=row["JB_PatientBasicInfoID"].ToString();
				}
				if(row["JiuZhenNO"]!=null)
				{
					model.JiuZhenNO=row["JiuZhenNO"].ToString();
				}
				if(row["ShenFenZhengNo"]!=null)
				{
					model.ShenFenZhengNo=row["ShenFenZhengNo"].ToString();
				}
				if(row["XingMing"]!=null)
				{
					model.XingMing=row["XingMing"].ToString();
				}
				if(row["XingBie"]!=null)
				{
					model.XingBie=row["XingBie"].ToString();
				}
				if(row["MinZu"]!=null)
				{
					model.MinZu=row["MinZu"].ToString();
				}
				if(row["ChuShengRiQi"]!=null && row["ChuShengRiQi"].ToString()!="")
				{
					model.ChuShengRiQi=DateTime.Parse(row["ChuShengRiQi"].ToString());
				}
				if(row["BingRenLaiYuanID"]!=null)
				{
					model.BingRenLaiYuanID=row["BingRenLaiYuanID"].ToString();
				}
				if(row["BingRenLeiXingID"]!=null)
				{
					model.BingRenLeiXingID=row["BingRenLeiXingID"].ToString();
				}
				if(row["BingRenLeiXing"]!=null)
				{
					model.BingRenLeiXing=row["BingRenLeiXing"].ToString();
				}
				if(row["DengJiShiJian"]!=null && row["DengJiShiJian"].ToString()!="")
				{
					model.DengJiShiJian=DateTime.Parse(row["DengJiShiJian"].ToString());
				}
				if(row["DengJiRenID"]!=null)
				{
					model.DengJiRenID=row["DengJiRenID"].ToString();
				}
				if(row["DengJiRenNO"]!=null)
				{
					model.DengJiRenNO=row["DengJiRenNO"].ToString();
				}
				if(row["DengJiRenXingMing"]!=null)
				{
					model.DengJiRenXingMing=row["DengJiRenXingMing"].ToString();
				}
				if(row["KeShiNO"]!=null)
				{
					model.KeShiNO=row["KeShiNO"].ToString();
				}
				if(row["KeShiMingCheng"]!=null)
				{
					model.KeShiMingCheng=row["KeShiMingCheng"].ToString();
				}
				if(row["BingQuNO"]!=null)
				{
					model.BingQuNO=row["BingQuNO"].ToString();
				}
				if(row["BingQuMingCheng"]!=null)
				{
					model.BingQuMingCheng=row["BingQuMingCheng"].ToString();
				}
				if(row["MenZhenNO"]!=null)
				{
					model.MenZhenNO=row["MenZhenNO"].ToString();
				}
				if(row["ZhuYuanNO"]!=null)
				{
					model.ZhuYuanNO=row["ZhuYuanNO"].ToString();
				}
				if(row["MenZhenZhuYuanBiaoShi"]!=null)
				{
					model.MenZhenZhuYuanBiaoShi=row["MenZhenZhuYuanBiaoShi"].ToString();
				}
				if(row["LinChuangZhenDuan"]!=null)
				{
					model.LinChuangZhenDuan=row["LinChuangZhenDuan"].ToString();
				}
				if(row["LinChuangZhenDuanBianMa"]!=null)
				{
					model.LinChuangZhenDuanBianMa=row["LinChuangZhenDuanBianMa"].ToString();
				}
				if(row["YingXiangZhenDuanBianMa"]!=null)
				{
					model.YingXiangZhenDuanBianMa=row["YingXiangZhenDuanBianMa"].ToString();
				}
				if(row["YingXiangZhenDuan"]!=null)
				{
					model.YingXiangZhenDuan=row["YingXiangZhenDuan"].ToString();
				}
				if(row["XiuGaiShiJian"]!=null && row["XiuGaiShiJian"].ToString()!="")
				{
					model.XiuGaiShiJian=DateTime.Parse(row["XiuGaiShiJian"].ToString());
				}
				if(row["XiuGaiRenID"]!=null)
				{
					model.XiuGaiRenID=row["XiuGaiRenID"].ToString();
				}
				if(row["XiuGaiRenNO"]!=null)
				{
					model.XiuGaiRenNO=row["XiuGaiRenNO"].ToString();
				}
				if(row["XiuGaiRenXingMing"]!=null)
				{
					model.XiuGaiRenXingMing=row["XiuGaiRenXingMing"].ToString();
				}
				if(row["JiuZhenZhuangTai"]!=null)
				{
					model.JiuZhenZhuangTai=row["JiuZhenZhuangTai"].ToString();
				}
				if(row["XiTongGuanLianHao"]!=null)
				{
					model.XiTongGuanLianHao=row["XiTongGuanLianHao"].ToString();
				}
				if(row["JiuZhenKeShiID"]!=null)
				{
					model.JiuZhenKeShiID=row["JiuZhenKeShiID"].ToString();
				}
				if(row["JianChaKeShiNO"]!=null)
				{
					model.JianChaKeShiNO=row["JianChaKeShiNO"].ToString();
				}
				if(row["JianChaKeShiMingCheng"]!=null)
				{
					model.JianChaKeShiMingCheng=row["JianChaKeShiMingCheng"].ToString();
				}
				if(row["YingWenMing"]!=null)
				{
					model.YingWenMing=row["YingWenMing"].ToString();
				}
				if(row["JiuZhenShiJian"]!=null && row["JiuZhenShiJian"].ToString()!="")
				{
					model.JiuZhenShiJian=DateTime.Parse(row["JiuZhenShiJian"].ToString());
				}
				if(row["WanChengShiJian"]!=null && row["WanChengShiJian"].ToString()!="")
				{
					model.WanChengShiJian=DateTime.Parse(row["WanChengShiJian"].ToString());
				}
				if(row["BingChuangHao"]!=null)
				{
					model.BingChuangHao=row["BingChuangHao"].ToString();
				}
				if(row["JianChaJiGouBianMa"]!=null)
				{
					model.JianChaJiGouBianMa=row["JianChaJiGouBianMa"].ToString();
				}
				if(row["JianChaJiGouID"]!=null)
				{
					model.JianChaJiGouID=row["JianChaJiGouID"].ToString();
				}
				if(row["JianChaJiGouMing"]!=null)
				{
					model.JianChaJiGouMing=row["JianChaJiGouMing"].ToString();
				}
				if(row["XieTongBiaoShi"]!=null)
				{
					model.XieTongBiaoShi=row["XieTongBiaoShi"].ToString();
				}
				if(row["QuYvShangChuanBiaoShi"]!=null)
				{
					model.QuYvShangChuanBiaoShi=row["QuYvShangChuanBiaoShi"].ToString();
				}
				if(row["QuYvQingQiuZhuangTai"]!=null)
				{
					model.QuYvQingQiuZhuangTai=row["QuYvQingQiuZhuangTai"].ToString();
				}
				if(row["SheBeiJianChaLiuShui"]!=null)
				{
					model.SheBeiJianChaLiuShui=row["SheBeiJianChaLiuShui"].ToString();
				}
				if(row["XianZhuZhi"]!=null)
				{
					model.XianZhuZhi=row["XianZhuZhi"].ToString();
				}
				if(row["GongZuoDanWei"]!=null)
				{
					model.GongZuoDanWei=row["GongZuoDanWei"].ToString();
				}
				if(row["JianChaZhuTuo"]!=null)
				{
					model.JianChaZhuTuo=row["JianChaZhuTuo"].ToString();
				}
				if(row["HuJi"]!=null)
				{
					model.HuJi=row["HuJi"].ToString();
				}
				if(row["DianHua"]!=null)
				{
					model.DianHua=row["DianHua"].ToString();
				}
				if(row["LianXiRen"]!=null)
				{
					model.LianXiRen=row["LianXiRen"].ToString();
				}
				if(row["LianXiRenDianHua"]!=null)
				{
					model.LianXiRenDianHua=row["LianXiRenDianHua"].ToString();
				}
				if(row["HunShi"]!=null)
				{
					model.HunShi=row["HunShi"].ToString();
				}
				if(row["XueXing"]!=null)
				{
					model.XueXing=row["XueXing"].ToString();
				}
				if(row["RHXueXing"]!=null)
				{
					model.RHXueXing=row["RHXueXing"].ToString();
				}
				if(row["HuJiDiShengID"]!=null)
				{
					model.HuJiDiShengID=row["HuJiDiShengID"].ToString();
				}
				if(row["HuJiDiShiID"]!=null)
				{
					model.HuJiDiShiID=row["HuJiDiShiID"].ToString();
				}
				if(row["HuJiDiXingZhengQuID"]!=null)
				{
					model.HuJiDiXingZhengQuID=row["HuJiDiXingZhengQuID"].ToString();
				}
				if(row["HuJiDiSheng"]!=null)
				{
					model.HuJiDiSheng=row["HuJiDiSheng"].ToString();
				}
				if(row["HuJiDiShi"]!=null)
				{
					model.HuJiDiShi=row["HuJiDiShi"].ToString();
				}
				if(row["HuJiDiXingZhengQu"]!=null)
				{
					model.HuJiDiXingZhengQu=row["HuJiDiXingZhengQu"].ToString();
				}
				if(row["HuJiDiZhi"]!=null)
				{
					model.HuJiDiZhi=row["HuJiDiZhi"].ToString();
				}
				if(row["QuYvBianMa"]!=null)
				{
					model.QuYvBianMa=row["QuYvBianMa"].ToString();
				}
				if(row["QuYvMingCheng"]!=null)
				{
					model.QuYvMingCheng=row["QuYvMingCheng"].ToString();
				}
				if(row["ShenQingZhaiYao"]!=null)
				{
					model.ShenQingZhaiYao=row["ShenQingZhaiYao"].ToString();
				}
			}
			return model;
		}

		/// <summary>
		/// 获得数据列表
		/// </summary>
		public DataSet GetList(string strWhere)
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("select ID,JB_PatientBasicInfoID,JiuZhenNO,ShenFenZhengNo,XingMing,XingBie,MinZu,ChuShengRiQi,BingRenLaiYuanID,BingRenLeiXingID,BingRenLeiXing,DengJiShiJian,DengJiRenID,DengJiRenNO,DengJiRenXingMing,KeShiNO,KeShiMingCheng,BingQuNO,BingQuMingCheng,MenZhenNO,ZhuYuanNO,MenZhenZhuYuanBiaoShi,LinChuangZhenDuan,LinChuangZhenDuanBianMa,YingXiangZhenDuanBianMa,YingXiangZhenDuan,XiuGaiShiJian,XiuGaiRenID,XiuGaiRenNO,XiuGaiRenXingMing,JiuZhenZhuangTai,XiTongGuanLianHao,JiuZhenKeShiID,JianChaKeShiNO,JianChaKeShiMingCheng,YingWenMing,JiuZhenShiJian,WanChengShiJian,BingChuangHao,JianChaJiGouBianMa,JianChaJiGouID,JianChaJiGouMing,XieTongBiaoShi,QuYvShangChuanBiaoShi,QuYvQingQiuZhuangTai,SheBeiJianChaLiuShui,XianZhuZhi,GongZuoDanWei,JianChaZhuTuo,HuJi,DianHua,LianXiRen,LianXiRenDianHua,HunShi,XueXing,RHXueXing,HuJiDiShengID,HuJiDiShiID,HuJiDiXingZhengQuID,HuJiDiSheng,HuJiDiShi,HuJiDiXingZhengQu,HuJiDiZhi,QuYvBianMa,QuYvMingCheng,ShenQingZhaiYao ");
			strSql.Append(" FROM YW_PatientVisitInfo ");
			if(strWhere.Trim()!="")
			{
				strSql.Append(" where "+strWhere);
			}
			return DbHelperSQL.Query(strSql.ToString());
		}

		/// <summary>
		/// 获得前几行数据
		/// </summary>
		public DataSet GetList(int Top,string strWhere,string filedOrder)
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("select ");
			if(Top>0)
			{
				strSql.Append(" top "+Top.ToString());
			}
			strSql.Append(" ID,JB_PatientBasicInfoID,JiuZhenNO,ShenFenZhengNo,XingMing,XingBie,MinZu,ChuShengRiQi,BingRenLaiYuanID,BingRenLeiXingID,BingRenLeiXing,DengJiShiJian,DengJiRenID,DengJiRenNO,DengJiRenXingMing,KeShiNO,KeShiMingCheng,BingQuNO,BingQuMingCheng,MenZhenNO,ZhuYuanNO,MenZhenZhuYuanBiaoShi,LinChuangZhenDuan,LinChuangZhenDuanBianMa,YingXiangZhenDuanBianMa,YingXiangZhenDuan,XiuGaiShiJian,XiuGaiRenID,XiuGaiRenNO,XiuGaiRenXingMing,JiuZhenZhuangTai,XiTongGuanLianHao,JiuZhenKeShiID,JianChaKeShiNO,JianChaKeShiMingCheng,YingWenMing,JiuZhenShiJian,WanChengShiJian,BingChuangHao,JianChaJiGouBianMa,JianChaJiGouID,JianChaJiGouMing,XieTongBiaoShi,QuYvShangChuanBiaoShi,QuYvQingQiuZhuangTai,SheBeiJianChaLiuShui,XianZhuZhi,GongZuoDanWei,JianChaZhuTuo,HuJi,DianHua,LianXiRen,LianXiRenDianHua,HunShi,XueXing,RHXueXing,HuJiDiShengID,HuJiDiShiID,HuJiDiXingZhengQuID,HuJiDiSheng,HuJiDiShi,HuJiDiXingZhengQu,HuJiDiZhi,QuYvBianMa,QuYvMingCheng,ShenQingZhaiYao ");
			strSql.Append(" FROM YW_PatientVisitInfo ");
			if(strWhere.Trim()!="")
			{
				strSql.Append(" where "+strWhere);
			}
			strSql.Append(" order by " + filedOrder);
			return DbHelperSQL.Query(strSql.ToString());
		}

		/// <summary>
		/// 获取记录总数
		/// </summary>
		public int GetRecordCount(string strWhere)
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("select count(1) FROM YW_PatientVisitInfo ");
			if(strWhere.Trim()!="")
			{
				strSql.Append(" where "+strWhere);
			}
			object obj = DbHelperSQL.GetSingle(strSql.ToString());
			if (obj == null)
			{
				return 0;
			}
			else
			{
				return Convert.ToInt32(obj);
			}
		}
		/// <summary>
		/// 分页获取数据列表
		/// </summary>
		public DataSet GetListByPage(string strWhere, string orderby, int startIndex, int endIndex)
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("SELECT * FROM ( ");
			strSql.Append(" SELECT ROW_NUMBER() OVER (");
			if (!string.IsNullOrEmpty(orderby.Trim()))
			{
				strSql.Append("order by T." + orderby );
			}
			else
			{
				strSql.Append("order by T.ID desc");
			}
			strSql.Append(")AS Row, T.*  from YW_PatientVisitInfo T ");
			if (!string.IsNullOrEmpty(strWhere.Trim()))
			{
				strSql.Append(" WHERE " + strWhere);
			}
			strSql.Append(" ) TT");
			strSql.AppendFormat(" WHERE TT.Row between {0} and {1}", startIndex, endIndex);
			return DbHelperSQL.Query(strSql.ToString());
		}

		/*
		*/

		#endregion  Method
		#region  MethodEx

		#endregion  MethodEx
	}
}

